package br.com.empresa.controller;

import java.net.URL;
import java.util.ResourceBundle;

import javax.swing.JOptionPane;

import br.com.empresa.dao.AlunoDao;
import br.com.empresa.modelo.Aluno;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;

public class AlunoController implements Initializable{
	
	  @FXML
	    private TextField txTelefone;

	    @FXML
	    private Button btLimpar;

	    @FXML
	    private TextField txCodigo;

	    @FXML
	    private TextField txPeriodo;

	    @FXML
	    private Button btSalvar;

	    @FXML
	    private TextField txEndereco;

	    @FXML
	    private TextField txTurma;

	    @FXML
	    private TextField txNome;

	    @FXML
	    private TextField txRg;

	    @FXML
	    private TextField txCpf;

	    @FXML
	    private TextField txIdade;

	    @FXML
	    void eventLimpar(ActionEvent event) {

	    }

	    @FXML
	    void eventSalvar(ActionEvent event) {
	    	Aluno al = new Aluno();
	    	al.setNome(txNome.getText());
	    	al.setRG(txRg.getText());
	    	al.setCPF(txCpf.getText());
	    	al.setTelefone(txTelefone.getText());
	    	al.setEndereco(txEndereco.getText());
	    	al.setTurma(txTurma.getText());
	    	al.setIdade(Integer.parseInt(txIdade.getText()));
	    	al.setPeriodo(txPeriodo.getText());
	    	al.setTipoPessoa();
	    	AlunoDao dao = new AlunoDao ();
	    	dao.inserir(al);	
		 }
		 

		@Override
		public void initialize(URL arg0, ResourceBundle arg1) {
			// TODO Auto-generated method stub
			
		}
		
		@FXML
	    void eventVoltar(ActionEvent event) {

	    }

}
